<template>
	<view class="content">

		<!-- 搜索部分 -->
		<view class="search_div" style="display: none;">
			<view class="search_border">
				<input class="et_word" maxlength="24" placeholder="请输入关键字" :value="word" @input="onInputWord" />
				<view style="color: #ccc;">|</view>
				<view style="padding: 24rpx 36rpx 24rpx 24rpx;" @click.stop="onSearch">搜索</view>
			</view>
		</view>

		<!-- 占位部分 -->
		<!-- <view style="width: 100rpx;height: 90rpx;"></view> -->
		<view style="width: 100rpx;height: 24rpx;"></view>

		<view class="data_item" v-for="(item,index) in data_list" :key="item.platform" @click.stop="onSelItem(item)">
			<view>系统名称：{{item.name || '暂未填写'}}</view>
			<view style="margin: 8rpx 0 0 0;color: #888;">系统代码：{{item.platform}}</view>
			<view style="height: 1rpx;width: 100%;background-color: #ddd;margin: 16rpx 0 0 0;"></view>
		</view>

		<!-- 空白数据提示 -->
		<view v-if="!data_list || data_list.length <= 0" style="width: 100vw;height: 40vh;line-height: 40vh;text-align: center;">暂无数据~</view>

	</view>
</template>

<script>
	import { getUInfo, timeStr2Timestamp, getCityAndProvince } from '@/util/util.js'
	export default {
		data() {
			return {
				data_list: [{ name: '车满满TMS', platform: 'cmm' }, { name: '全球通TMS', platform: 'qqt' }],

				word: '', // 搜索关键字
			}
		},

		mounted() {
			// this.getDataList()
		},

		methods: {

			// 监听:输入关键字
			onInputWord(e) {
				this.word = e.detail.value
			},

			// 点击选择数据
			onSelItem(item) {
				uni.$emit('onSelTms', { msg: item })
				uni.navigateBack()
			},
			// 点击搜索
			onSearch() {
				this.getDataList()
			},

			// 接口:数据列表
			async getDataList() {
				this.data_list = []
				let that = this
				let token = getUInfo().token
				uni.showLoading({ title: '加载中', mask: true, })
				let res = await this.$getUserList({ token, page: 1, page_size: 99999999, keywords: this.word })
				// console.log('$getUserList.res =', res);
				if (res.code == 1) {
					this.data_list = res.data.data
				} else {
					this.$toast(res.msg)
				}
			},
		}
	}
</script>

<style scoped>
	.content {
		position: relative;
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: column;
	}

	.search_div {
		position: fixed;
		height: 90rpx;
		width: calc(100%);
		background-color: white;
		z-index: 1;
	}

	.search_border {
		display: flex;
		align-items: center;
		width: calc(100% - 48rpx);
		height: calc(100% - 24rpx);
		margin: 12rpx 24rpx 12rpx 24rpx;
		border: solid 1rpx #ccc;
		border-radius: 888rpx;
	}

	.et_word {
		flex-grow: 1;
		padding: 0 0 0 48rpx;
	}

	.data_item {
		display: flex;
		flex-direction: column;
		margin: 20rpx;
		font-size: 28rpx;
	}
</style>